﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HMP.BL;

namespace HMP.GUI
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }


        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtLogPassword.Text.Trim() == "" || txtLogUserName.Text.Trim() == "")
            {
                MessageBox.Show("Input User Name and Password", "Warning!", MessageBoxButtons.OK);
            }
            else
            {
                string a = txtLogUserName.Text;
                if (BL.CheckDataBL.KTTonTai(txtLogUserName.Text))
                {
                    MessageBox.Show("Log In Successful", "Message!", MessageBoxButtons.OK);
                    //MainForm1 frm = new MainForm1();
                    //frm.Show();
                    //this.Dispose();
                }
                else
                {
                    MessageBox.Show("Log In Fail", "Message!", MessageBoxButtons.OK);
                }
            }


        }

        //SELECT ALL INPUT FROM USERNAME TEXTBOX
        private void txtLogUserName_Enter(object sender, EventArgs e)
        {
            TextBox txtLogUserName = sender as TextBox;
            txtLogUserName.SelectAll();
        }
    }
}
